﻿
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using Model;


namespace MsDAL
{
    public partial class Sys5a10DAL : Sys5a10Base
    {
        public DataTable LoadSalustion(string usercode, string pagename, string ctl)
        {
            string sql = "SELECT (CASE WHEN usercode IS NULL THEN providname ELSE usercode + ' : ' + providname END) AS providname, listid "
                + " FROM Sys5a10 WHERE (ispublic = 'Y' OR usercode =@usercode) AND "
                + " EXISTS(SELECT 1 FROM Sys5a00 z WHERE z.listid = pagelistid "
                + "        AND pagename = @pagename AND ctlname = @ctl) ORDER BY tmp4 DESC,usercode DESC";

            return DBHelper.GetData(sql, new SqlParameter("usercode", usercode),
                 new SqlParameter("pagename", pagename),
                 new SqlParameter("ctl", ctl));
        }
    }
}
